//
//  WHJSHandle.m
//  LvZhongMagicKey
//
//  Created by 邓伟浩 on 2018/6/4.
//  Copyright © 2018年 邓伟浩. All rights reserved.
//

#import "WHJSHandle.h"

@implementation WHJSHandle

- (instancetype)initWithViewController:(UIViewController *)webVC configuration:(WKWebViewConfiguration *)configuration {
    self = [super init];
    if (self) {
        _webVC = webVC;
        _configuration = configuration;
//        [configuration.userContentController addScriptMessageHandler:self name:@"contactService"];
        
    }
    return self;
}

#pragma mark -  JS 调用 Native  代理
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
//    if ([message.name isEqualToString:@"contactService"]) {
//        UIWebView *callWebview = [[UIWebView alloc] init];
//        [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:message.body]]];
//        [kAppWindow addSubview:callWebview];
//    }
}

#pragma mark -  记得要移除
- (void)cancelHandler {
//    [_configuration.userContentController removeScriptMessageHandlerForName:@"contactService"];
//    [_configuration.userContentController removeScriptMessageHandlerForName:@"updatAccountMoney"];
}

- (void)dealloc {
    
}

@end
